package com.cjbdi.dao;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.cjbdi.entity.CourtSubscribe;

@Repository
public interface CourtSubscribeRepository extends JpaRepository<CourtSubscribe, Long> {
	
	@Query(value = "select * from court_subscribe where fybm = :fybm", nativeQuery = true)
	List<CourtSubscribe> findByFybm(@Param("fybm") String fybm);
	
	@Query(value = "select * from court_subscribe as a where case when :name!='' then sfunction like '%'||:name||'%' else 1=1 end", nativeQuery = true)
    List<CourtSubscribe> findByName(@Param("name") String name);

}
